import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    task: JSON.parse(
      localStorage.getItem('task')
    ),
    script: JSON.parse(
      localStorage.getItem('script')
    ),
    zlscript: JSON.parse(
      localStorage.getItem('zlscript')
    )
  },
  mutations: {
    changeValue (state, payload) {
      state[payload.key] = payload.value
    },
    addChild (state, payload) {
      state[payload.key].push(payload.value)
    }
  }
})
